package com.xon.lotp.controller;

import com.xon.lotp.pojo.Group;
import com.xon.lotp.pojo.Project;
import com.xon.lotp.service.GroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Controller
@CrossOrigin // 跨域处理

public class GroupController {

    @Autowired
    GroupService groupService;

    @ResponseBody
    @RequestMapping(value = "/viewAllGroups", method = RequestMethod.POST)
    public List<Group> viewAllGroups(String projectId) {
        return groupService.viewAllGroups(projectId);
    }

    @ResponseBody
    @GetMapping("/showMyGroups")
    public List<Group> showMyGroups(String userId) {
        List<Group> result = groupService.showMyGroups(userId);
        return result;
    }

    @ResponseBody
    @RequestMapping(value = "/createProject" ,method = RequestMethod.POST)
    public int createProject(Map<String, Object> param) {
        Group group = new Group();
        return 0;
    }

}

